home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / bbs / cddk9606.zip / HEADERS.ARJ / SLICER.INT < prev    next >
Text File  |  1996-06-14  |  9KB  |  371 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  SLICER: Time-slicing support                                             }
  4. {  Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide               }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT Slicer;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. CONST
  21.  
  22.   _DOS       = 0;
  23.   _DesqView  = 1;
  24.   _DoubleDOS = 2;
  25.   _OS2       = 3;
  26.   _TopView   = 4;
  27.   _Windows   = 5;
  28.  
  29.  
  30. {#Start}
  31.  
  32. FUNCTION DesqView:Boolean;
  33.   {
  34.   PURPOSE  : Returns TRUE if DesqView is installed, FALSE if not.
  35.  
  36.   SEE ALSO : DOSShell, DoubleDOS, OS2, TopView, Windows, Windows_Real
  37.   }
  38.  
  39.  
  40. FUNCTION DesqView_Version:Word;
  41.   {
  42.   PURPOSE  : Returns the version of DesqView.
  43.  
  44.   NOTES    : The major version is returned in the low byte; the minor
  45.              version is returned in the high byte.  This function properly
  46.              handles the version bug found in some early copies of
  47.              DesqView 2.0.
  48.  
  49.   SEE ALSO : DOS_Version, DoubleDOS_Version, OS2_Version,
  50.              TopView_Version, Windows_Version
  51.   }
  52.  
  53.  
  54. FUNCTION DOSShell:Boolean;
  55.   {
  56.   PURPOSE  : Returns TRUE if the DOS 5+ task switcher is loaded.
  57.  
  58.   SEE ALSO : DesqView, DoubleDOS, OS2, TopView, Windows, Windows_Real
  59.   }
  60.  
  61.  
  62. PROCEDURE DOS_Release;
  63.   {
  64.   PURPOSE  : Notifies DOS that the program is idle.
  65.  
  66.   SEE ALSO : Release, DoubleDOS_Release, TopView_Release, Windows_Release
  67.   }
  68.  
  69.  
  70. FUNCTION DOS_Version:Word;
  71.   {
  72.   PURPOSE  : Returns the version of DOS on the local computer.
  73.  
  74.   NOTES    : The major version is returned in the low byte; the minor
  75.              version is returned in the high byte.
  76.  
  77.   SEE ALSO : DesqView_Version, DoubleDOS_Version, OS2_Version,
  78.              TopView_Version, Windows_Version
  79.   }
  80.  
  81.  
  82. FUNCTION DoubleDOS:Boolean;
  83.   {
  84.   PURPOSE  : Returns TRUE is DoubleDOS is installed, FALSE if not.
  85.  
  86.   SEE ALSO : DesqView, DOSShell, OS2, TopView, Windows, Windows_Real
  87.   }
  88.  
  89.  
  90. PROCEDURE DoubleDOS_CriticalBegin;
  91.   {
  92.   PURPOSE  : Disables multitasking in DoubleDOS.
  93.  
  94.   SEE ALSO : DoubleDOS_CriticalEnd
  95.   }
  96.  
  97.  
  98. PROCEDURE DoubleDOS_CriticalEnd;
  99.   {
  100.   PURPOSE  : Enables multitasking in DoubleDOS.
  101.  
  102.   SEE ALSO : DoubleDOS_CriticalBegin
  103.   }
  104.  
  105.  
  106. PROCEDURE DoubleDOS_Release;
  107.   {
  108.   PURPOSE  : Releases a single 55 ms timeslice back to DoubleDOS
  109.  
  110.   SEE ALSO : Release, DOS_Release, TopView_Release, Windows_Release
  111.   }
  112.  
  113.  
  114. FUNCTION DoubleDOS_Version:Word;
  115.   {
  116.   PURPOSE  : This dummy function always returns 0.  Please contact
  117.              the author if you have technical information on the
  118.              DoubleDOS multitasker.
  119.  
  120.   SEE ALSO : DesqView_Version, DOS_Version, OS2_Version,
  121.              TopView_Version, Windows_Version
  122.   }
  123.  
  124.  
  125. FUNCTION OS2:Boolean;
  126.   {
  127.   PURPOSE  : Returns TRUE if OS/2 (Operating System/2) is detected on
  128.              the local computer.
  129.  
  130.   SEE ALSO : DesqView, DOSShell, DoubleDOS, TopView, Windows, Windows_Real
  131.   }
  132.  
  133.  
  134. FUNCTION OS2_Version:Word;
  135.   {
  136.   PURPOSE  : Returns the version of OS/2.
  137.  
  138.   NOTES    : The major version is returned in the low byte; the minor
  139.              version is returned in the high byte.  The return value
  140.              of $0302 (2.3) is remapped to $0003 (3.0).
  141.  
  142.   SEE ALSO : DesqView_Version, DOS_Version, DoubleDOS_Version,
  143.              TopView_Version, Windows_Version
  144.   }
  145.  
  146.  
  147. FUNCTION TopView:Boolean;
  148.   {
  149.   PURPOSE  : Returns TRUE if TopView or compatible is loaded.
  150.  
  151.   SEE ALSO : DesqView, DOSShell, DoubleDOS, OS2, Windows, Windows_Real
  152.   }
  153.  
  154.  
  155. PROCEDURE TopView_CriticalBegin;
  156.   {
  157.   PURPOSE  : Disables task-switching in TopView or DesqView.
  158.  
  159.   SEE ALSO : TopView_CriticalEnd
  160.   }
  161.  
  162.  
  163. PROCEDURE TopView_CriticalEnd;
  164.   {
  165.   PURPOSE  : Enables task-switching in TopView or DesqView.
  166.  
  167.   SEE ALSO : TopView_CriticalBegin
  168.   }
  169.  
  170.  
  171. PROCEDURE TopView_Release;
  172.   {
  173.   PURPOSE  : Releases the current timeslice back to TopView or DesqView.
  174.  
  175.   SEE ALSO : Release, DOS_Release, DoubleDOS_Release, Windows_Release
  176.   }
  177.  
  178.  
  179. FUNCTION TopView_Version:Word;
  180.   {
  181.   PURPOSE  : Returns the version of TopView.
  182.  
  183.   NOTES    : The major version is returned in the low byte; the minor
  184.              version is returned in the high byte.
  185.  
  186.   SEE ALSO : DesqView_Version, DOS_Version, DoubleDOS_Version, OS2_Version,
  187.              Windows_Version
  188.   }
  189.  
  190.  
  191. FUNCTION Windows:Boolean;
  192.   {
  193.   PURPOSE  : Returns TRUE if Windows 3.x, Windows 95 or Windows NT is
  194.              detected on the local computer.
  195.  
  196.   SEE ALSO : DesqView, DOSShell, DoubleDOS, OS2, TopView, Windows_Real
  197.   }
  198.  
  199.  
  200. PROCEDURE Windows_CriticalBegin;
  201.   {
  202.   PURPOSE  : Disables task switching in Windows 3.0+
  203.  
  204.   SEE ALSO : Windows_CriticalEnd
  205.   }
  206.  
  207.  
  208. PROCEDURE Windows_CriticalEnd;
  209.   {
  210.   PURPOSE  : Enables task switchin in Windows 3.0+
  211.  
  212.   SEE ALSO : Windows_CriticalBegin
  213.   }
  214.  
  215.  
  216. PROCEDURE Windows_Release;
  217.   {
  218.   PURPOSE  : Releases the current timeslice to the operating system.
  219.  
  220.   NOTES    : This call is supported by Windows 3.0+, DOS 5+, DPMI 1.0+,
  221.              and OS/2 2.0+ for multitasking DOS applications.  Windows
  222.              applications should not use this function.
  223.  
  224.   SEE ALSO : Release, DOS_Release, DoubleDOS_Release, TopView_Release
  225.   }
  226.  
  227.  
  228. FUNCTION Windows_Version:Word;
  229.   {
  230.   PURPOSE  : Returns the current Windows version.
  231.  
  232.   NOTES    : The major version is returned in the low byte; the minor
  233.              version is returned in the high byte.  The function is
  234.              unable to detect the exact version of Windows/386 2.x.
  235.              All 2.x versions are returned as 2.0.
  236.  
  237.   SEE ALSO : DesqView_Version, DOS_Version, DoubleDOS_Version, OS2_Version,
  238.              TopView_Version
  239.   }
  240.  
  241.  
  242. FUNCTION Windows_Real:Boolean;
  243.   {
  244.   PURPOSE  : Returns TRUE if Windows is running in standard (real) mode.
  245.  
  246.   SEE ALSO : DesqView, DOSShell, DoubleDOS, OS2, TopView, Windows
  247.   }
  248.  
  249.  
  250. FUNCTION ForceFalse:Boolean;
  251.   {
  252.   PURPOSE  : Always returns FALSE.
  253.  
  254.   SEE ALSO : ForceTrue, NullProc
  255.   }
  256.  
  257.  
  258. FUNCTION ForceTrue:Boolean;
  259.   {
  260.   PURPOSE  : Always returns TRUE.
  261.  
  262.   SEE ALSO : ForceFalse, NullProc
  263.   }
  264.  
  265.  
  266. PROCEDURE NullProc;
  267.   {
  268.   PURPOSE  : Does nothing.
  269.  
  270.   SEE ALSO : ForceFalse, ForceTrue
  271.   }
  272.  
  273.  
  274. PROCEDURE Release;
  275.   {
  276.   PURPOSE  : Releases the current timeslice back to the operating system.
  277.  
  278.   NOTES    : This procedure merely calls Tasker[MT].Release, where MT
  279.              is a byte indentifying the operating system:
  280.  
  281.                  _DOS       = 0;
  282.                  _DesqView  = 1;
  283.                  _DoubleDOS = 2;
  284.                  _OS2       = 3;
  285.                  _TopView   = 4;
  286.                  _Windows   = 5;
  287.  
  288.              It is more efficient to caller Tasker[MT].Release, although
  289.              not much more efficient.  You may also force Concerto to
  290.              use a different method:
  291.  
  292.                  Example: Tasker[_Windows].Release
  293.                  Example: Tasker[_TopView].Release
  294.  
  295.  
  296.   SEE ALSO : DOS_Release, DoubleDOS_Release, TopView_Release, Windows_Release
  297.   }
  298.  
  299.  
  300. TYPE
  301.  
  302.   tMultiTasker = RECORD
  303.     Detected      : FUNCTION:Boolean;
  304.     CriticalBegin : PROCEDURE;
  305.     CriticalEnd   : PROCEDURE;
  306.     Release       : PROCEDURE;
  307.     Version       : FUNCTION:Word;
  308.     END;
  309.  
  310.  
  311. CONST
  312.  
  313.   MT : Byte = 0;
  314.  
  315.   Tasker : ARRAY[0..5] OF tMultiTasker =
  316.  
  317.     { DOS }
  318.  
  319.     (( Detected      : ForceTrue;
  320.        CriticalBegin : NullProc;
  321.        CriticalEnd   : NullProc;
  322.        Release       : DOS_Release;
  323.        Version       : DOS_Ve